// 06-radio.js
const Event = require('events');

class Radio extends Event {
  constructor(station) {
    super();
    this.station = station;
  }

  play() {
    console.log(`Playing: ${this.station.freq}`);
    setTimeout(() => {
      this.emit('play', this.station);
    }, 0);
  }

  stop() {
    console.log(`Stopping: ${this.station.name}`);
    setTimeout(() => {
      this.emit('stop', this.station);
    }, 5000);
  }
}

module.exports = Radio;